package com.msb.dongbao.common.base.result;

import com.msb.dongbao.common.base.enums.StateCodeEnum;
import lombok.Builder;
import lombok.Data;

import java.io.Serializable;
@Data
@Builder
public class ResultWrapper<T> implements Serializable {

    //状态码
    private int code;
    //返回信息
    private String msg;
    //返回数据
    private T data;


    public static <T> ResultWrapper.ResultWrapperBuilder getSuccessBuilder(T data){
        return ResultWrapper.builder().code(StateCodeEnum.SUCCESS.getCode()).msg(StateCodeEnum.SUCCESS.getMsg()).data(data);
    }
    public static <T> ResultWrapper.ResultWrapperBuilder getFailBuilder(T data){
       return ResultWrapper.builder().code(StateCodeEnum.FAIL.getCode()).msg(StateCodeEnum.FAIL.getMsg()).data(data);
    }

}
